﻿using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using System.Windows.Ink;
using LiveChartsCore.SkiaSharpView.Extensions;
using LiveChartsCore.SkiaSharpView.VisualElements;

namespace BlankApp1.ViewModels
{
    partial class AViewModel : ObservableObject
    {
        public AViewModel() {
            var outer = 0;
            var data = new[] { 6, 5, 4, 3, 2 };

            // you can convert any array, list or IEnumerable<T> to a pie series collection:
            Series4 = data.AsPieSeries((value, series) =>
            {
                // this method is called once per element in the array
                // we are decrementing the outer radius 50px
                // on every element in the array.

                series.InnerRadius = 50;
                series.OuterRadiusOffset = outer;
                outer += 50;
            });
        }

        [ObservableProperty]
        private string title = "ViewA";

        public ISeries[] Series { get; set; }
            = new ISeries[]
            {
                new LineSeries<double>
                {
                    Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
                    Fill = null
                }
            };

        public ISeries[] Series2 { get; set; } =
        {
            new ColumnSeries<double>
            {
                IsHoverable = false, // disables the series from the tooltips 
                Values = new double[] { 10, 10, 10, 10, 10, 10, 10 },
                Stroke = null,
                Fill = new SolidColorPaint(new SKColor(30, 30, 30, 30)),
                IgnoresBarPosition = true
            },
            new ColumnSeries<double>
            {
                Values = new double[] { 3, 10, 5, 3, 7, 3, 8 },
                Stroke = null,
                Fill = new SolidColorPaint(SKColors.CornflowerBlue),
                IgnoresBarPosition = true
            }
        };

        public Axis[] YAxes2 { get; set; } =
        {
            new Axis { MinLimit = 0, MaxLimit = 10 }
        };
        public IEnumerable<ISeries> Series3 { get; set; } =
        new[] { 2, 4, 1, 4, 3 }.AsPieSeries();

        public LabelVisual Title3 { get; set; } =
           new LabelVisual
           {
               Text = "My chart title",
               TextSize = 25,
               Padding = new LiveChartsCore.Drawing.Padding(15),
               Paint = new SolidColorPaint(SKColors.DarkSlateGray)
           };
        public IEnumerable<ISeries> Series4 { get; set; }
    }
}
